package com.sunday.common.mongo.study.aggregate;

import com.sunday.common.core.gson.GsonUtils;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Description: 用户角色关系表
 * @author: zsy
 * @Create: 2022/11/10 10:53:45
 */
@Data
@Document("sunday_user_role")
public class UserRole implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    private Long id;

    /**
     * 用户ID
     */
    @Field("user_id")
    private Long userId;

    /**
     * 角色ID
     */
    @Field("role_id")
    private Long roleId;

    /**
     * 创建时间
     */
    @Field("create_time")
    private LocalDateTime createTime;

    /**
     * 最后修改时间
     */
    @Field("update_time")
    private LocalDateTime updateTime;


    @Override
    public String toString() {
        return GsonUtils.DEFAULT.toJson(this);
    }
}
